import 'package:flutter/material.dart';
import 'package:getwidget/getwidget.dart';

class ListPro extends StatefulWidget {
  @override
  _ListProState createState() => _ListProState();
}

class _ListProState extends State<ListPro> {

  late PageController _pageController;
  late List<Widget> slideList;
  late int initialPage;
  int groupValue = 0;
  @override
  void initState() {
    _pageController = PageController(initialPage: 2);
    initialPage = _pageController.initialPage;
    super.initState();
  }

  @override
  Widget build(BuildContext context) => Scaffold(
    backgroundColor:  Colors.grey[200],
    body: SafeArea(
      child: GFIntroScreen(
        height: MediaQuery.of(context).size.height*0.7,
        width: MediaQuery.of(context).size.width * 0.9,
        color: Colors.grey[200],
        borderRadius: BorderRadius.circular(40),
        border: Border.all(color: Colors.grey),
        slides: slides(),
        pageController: _pageController,
        introScreenBottomNavigationBar: GFIntroScreenBottomNavigationBar(
          pageController: _pageController,
          pageCount: slideList.length,
          currentIndex: initialPage,
          backButtonText: 'Previous',
          forwardButtonText: 'Next',
          skipButtonText: 'Skip',
          doneButtonText: 'Done',
          navigationBarHeight: 50,
          navigationBarWidth: 300,
          navigationBarShape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(60),
          ),
          navigationBarColor: Colors.white,
          showDivider: false,
          dotHeight: 10,
          dotWidth: 16,
          dotShape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(5)),
          inactiveColor: Colors.grey,
          activeColor: GFColors.SUCCESS,
          dotMargin: EdgeInsets.symmetric(horizontal: 6),
          showPagination: true,
        ), currentIndex: 1, pageCount: 1,
      ),
    ),
  );

  List<Widget> slides() {
    slideList = [
      Container(
        child: GFImageOverlay(
          width: MediaQuery.of(context).size.width,
          padding: EdgeInsets.all(16),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Padding(
                padding: const EdgeInsets.only(top: 10.0, left: 20),
                child: Text(
                  'Welcome Back!',
                  style: TextStyle(color: Colors.white,decoration: TextDecoration.none,fontSize: 25),
                ),
              ),
            ],
          ),
          color: Colors.orange,
          image: const AssetImage('lib/assets/images/i1.png'),
          boxFit: BoxFit.cover,
          colorFilter:
          ColorFilter.mode(Colors.black.withOpacity(0.2), BlendMode.darken),
          borderRadius: BorderRadius.only(
              topLeft: Radius.circular(40), topRight: Radius.circular(40)),
        ),
      ),
      Container(
        width: MediaQuery.of(context).size.width,
        height: MediaQuery.of(context).size.height,
        decoration: BoxDecoration(
            borderRadius: BorderRadius.only(
                topLeft: Radius.circular(40), topRight: Radius.circular(40)),
            image: DecorationImage(
              image: AssetImage('lib/assets/bg_login.jpg'),
              fit: BoxFit.fill,
              colorFilter: ColorFilter.mode(
                  Colors.black.withOpacity(0.2), BlendMode.darken),
            )),
      ),
      Container(
        width: MediaQuery.of(context).size.width,
        height: MediaQuery.of(context).size.height,
        decoration: BoxDecoration(
            borderRadius: BorderRadius.only(
                topLeft: Radius.circular(40), topRight: Radius.circular(40)),
            image: DecorationImage(
              image: AssetImage('lib/assets/bg_login.jpg'),
              fit: BoxFit.fill,
              colorFilter: ColorFilter.mode(
                  Colors.black.withOpacity(0.2), BlendMode.darken),
            )),
      ),
      Container(
        width: MediaQuery.of(context).size.width,
        height: MediaQuery.of(context).size.height,
        decoration: BoxDecoration(
            borderRadius: BorderRadius.only(
                topLeft: Radius.circular(40), topRight: Radius.circular(40)),
            image: DecorationImage(
              image: AssetImage('lib/assets/bg_login.jpg'),
              fit: BoxFit.fill,
              colorFilter: ColorFilter.mode(
                  Colors.black.withOpacity(0.2), BlendMode.darken),
            )),
      ),
    ];
    return slideList;
  }
}
